<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	session.setAttribute("basePath", basePath);
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户信息修改</title>
<script type="text/javascript" src="${basePath }js/jquery-2.1.4.js"></script>
<script type="text/javascript" src="${basePath }js/bootstrap.min.js"></script>
<link rel="stylesheet" href="${basePath }css/bootstrap.min.css">
	<script type="text/javascript">
		function check(){
			var flag = true;
			var pic = document.getElementById("userPhotoPath").value;
			var password = document.getElementById("userPassword").value;
			if ("" == pic){
				alert("请添加头像！");
				flag = false;
				return false;
			}
			else if ("" == password){
				alert("密码不能为空！");
				flag = false;
				return false;
			}
			if(flag == true){
				//form.submit();
				return true;
			}
		}
	</script>
</head>
<body>
	<div class="container">
		<div class="row" style="margin-top: 180px">
			<div class="col-md-4"></div>
			<div class="col-md-4">
				<h3 class="text-center">用户修改</h3>
				<form class="form-horizontal" action="${basePath}user/doupdate.do"
					method="post" enctype="multipart/form-data">
					<div class="form-group">
						<label for="file" class="col-sm-2 control-label">头像</label>
						<div class="col-sm-10">
							<input type="file" class="form-control" id="file" style="border: solid 0px"
								   name="file" value="${updateUser.userPhotoPath }">
							<input type="hidden" name="filepath" id="filepath">
						</div>
					</div>
					<div class="form-group">
						<label for="userId" class="col-sm-2 control-label">账号</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="userId"
								   name="userId" value="${updateUser.userId }" readonly="readonly">
						</div>
					</div>
					<div class="form-group">
						<label for="userName" class="col-sm-2 control-label">姓名</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="userName"
								   name="userName" value="${updateUser.userName }" readonly="readonly">
						</div>
					</div>
					<div class="form-group">
						<label for="userPassword" class="col-sm-2 control-label">密码</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="userPassword"
								   name="userPassword" value="${updateUser.userPassword }"placeholder="请输入修改的密码">
						</div>
					</div>
					<div class="form-group">
						<label for="roleDO.roleName" class="col-sm-2 control-label">身份</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" id="roleDO.roleName"
								   name="roleDO.roleName" value="${updateUser.roleDO.roleName}" readonly="readonly">
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-10">
						<button style="width:100% " class="btn btn-primary btn-lg pull-right " onclick="return check();" >修改</button>
					</div>
						</div>
				</div>
			</form>
		</div>
		<div class="col-md-4"></div>
	</div>
	</div>
</body>
</html>